Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][Ext][Bindless] Initial implementation of image spirv builtins on HIP #16439

Open
wants to merge 2 commits into
base: sycl
Choose a base branch
from

Conversation

GeorgeWeb
Copy link
Contributor

@GeorgeWeb GeorgeWeb commented Dec 20, 2024

This PR implements the required spirv builtins in the libclc for AMD targets to support image fetching (excluding sampled fetch for now) and sampling as well as image array fetching and sampling.

Additionally, End-to-end tests are updated to require the aspects corresponding to the feature that is being tested from the Bindless Images extension. This helps avoid having to manually say which backend adapter is supported or unsupported and instead rely on support based on aspect/device queries to drive the execution of the tests.

HIP adapter implementation in UR: oneapi-src/unified-runtime#2496

Signed-off-by: Georgi Mirazchiyski [email protected]

…on HIP

TODO: Complete the description with more information.

Signed-off-by: Georgi Mirazchiyski <[email protected]>
@GeorgeWeb
Copy link
Contributor Author

GeorgeWeb commented Jan 7, 2025

I appreciate that image.cl is quite large and can only grow more (e.g. mipmaps, cubemaps, etc.) in the future, so I can consider splitting into image.cl for image/sampling functions, image_array.cl for image array/array sampling functions and image_common.h to hold all the commonly shared macros and functions.

Copy link
Contributor

@jchlanda jchlanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

This patch brings in a lot of new hand mangled names, was wondering if it would be at all possible to try and avoid those?

#endif

#ifdef _WIN32
#define _CLC_MANGLE_FUNC_IMG_HANDLE(namelength, name, prefix, postfix) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that the kind of thing that the remangler should handle, as in m - y, long (long) unsigned?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jchlanda I agree that it should probably be the case.
We have that tendency of manually mangling these, for example, also in the atomics libspirv function implementations. This particular case here is adapted from the libspirv ptx image implementation. I think it is the perfect candidate to create a follow-up for, where we attempt to cleanup some of the manual mangling (at least for the image functions) across both ptx and amdgcn libspirv target implementations. I'll create an internal ticket for our team to follow this up. Does that sound okay?

@jchlanda
Copy link
Contributor

jchlanda commented Jan 8, 2025

I appreciate that image.cl is quite large and can only grow more (e.g. mipmaps, cubemaps, etc.) in the future, so I can consider splitting into image.cl for image/sampling functions, image_array.cl for image array/array sampling functions and image_common.h to hold all the commonly shared macros and functions.

I think that would be a good idea.


// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// RUN: %if !any-device-is-hip %{ %{build} -o %t.out %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not the same as doing // UNSUPPORTED: HIP? If so, would that style not be better?

Copy link
Contributor Author

@GeorgeWeb GeorgeWeb Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it absolutely is. That's a weird leftover I didn't spot. Should be changed to // UNSUPPORTED: HIP with a reasonable UNSUPPORTED-INTEDED description, and will do. (Think I did that before knowing I had to do UNSUPPORTED-INTEDED for unsupported targets 😅)

@GeorgeWeb GeorgeWeb force-pushed the georgi/bindless-hip branch from eadd947 to e5e0d35 Compare January 23, 2025 18:14
// REQUIRES: aspect-ext_oneapi_bindless_images

// UNSUPPORTED: hip || level_zero
// UNSUPPORTED-INTENDED: Returning non-FP values from fetching fails on HIP.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// UNSUPPORTED-INTENDED: Returning non-FP values from fetching fails on HIP.
// UNSUPPORTED-INTENDED: Returning non-FP values from sampling fails on HIP.

Fetching implies no sampling is occuring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sycl-bindless-images SYCL Bindless Images
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants